package com.heima.model.wemedia.utils;

import com.heima.model.wemedia.pojos.WmUser;

/**
 * @author 姜星宇
 * @date 2024/8/27 12:20
 */
public class WmThreadLocalUtil {

    private WmThreadLocalUtil(){

    }

    private final static ThreadLocal<WmUser> WM_USER_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 添加用户
     */
    public static  void  setUser(WmUser wmUser){
        WM_USER_THREAD_LOCAL.set(wmUser);
    }

    /**
     * 获取用户
     */
    public static  WmUser getUser(){
        return WM_USER_THREAD_LOCAL.get();
    }

    /**
     * 清理用户
     */
    public static  void clear(){
        WM_USER_THREAD_LOCAL.remove();
    }
}
